const wait = () => new Promise(resolve => {
  setTimeout(()=>{
    console.log('just exec once');
    resolve('success')
  }, 3000)
})

const memorize = async (cb) => {
  if(result){
    return result
  }
  let result = null
  result = await cb()
  return () => result
}

const fn = memorize(wait)
console.log(fn())
console.log(fn())
console.log(fn())